package com.example.mapper;

import com.example.entity.Orders;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 康伟奇
 * @date: 2023 - 11 - 23 11:38
 **/
public interface OrdersMapper {

    /**
     * 新增
     */
    int insert(Orders orders);

    /**
     * 删除
     */
    int deleteById(Integer id);

    /**
     * 修改
     */
    int updateById(Orders orders);

    /**
     * 根据ID查询
     */
    Orders selectById(Integer id);

    /**
     * 查询所有
     */
    List<Orders> selectAll(Orders orders);

    @Select("select * from orders where business_id = #{businessId} and (status = '待评价' or status = '已完成')")
    List<Orders> selectUsageByBusinessId(Integer businessId);

    @Select("select * from orders where business_id = #{businessId}")
    List<Orders> selectByBusinessId(Integer businessId);
}
